package com.ehotting.mqbd.api.bean;

import com.ehotting.mqbd.api.enums.MQDataPushModelEnum;
import com.ehotting.mqbd.api.enums.TopicEnum;
import org.springframework.util.Assert;

public class MQHttpData extends MQBaseData<CommonRequest,CommonResponse> {

    private CommonRequest request;

    private CommonResponse response;

    public MQHttpData() {
        super();
        this.pushModel = MQDataPushModelEnum.HTTP_PUSH;
    }


    public MQHttpData(TopicEnum topic, String consumerHost, String localHost, String agentId, String module, String msg) {
        super( topic, consumerHost,  localHost,  agentId,  module,  msg);
        this.pushModel = MQDataPushModelEnum.HTTP_PUSH;
    }

    public static MQHttpData create(TopicEnum topic, String consumerHost, String localHost, String agentId, String module, String msg){
        Assert.notNull(topic,"topic is null");
        return new MQHttpData( topic, consumerHost,  localHost,  agentId,  module,  msg);
    }

    public static MQHttpData create(TopicEnum topic,MqApplicationContext mqApplicationContext, String agentId,  String msg){
        Assert.notNull(topic,"topic is null");
        return new MQHttpData( topic, mqApplicationContext.getConsumerHost(),  mqApplicationContext.getLocalHost(),  agentId,  mqApplicationContext.getModule(),  msg);
    }

    @Override
    public CommonRequest getRequest() {
        return request;
    }



    public   void  setRequest(CommonRequest request) {
        this.request = request;
    }

    @Override
    public CommonResponse getResponse() {
        return response;
    }


    public void setResponse(CommonResponse response) {
        this.response = response;

    }


}